import { useEffect, useState } from "react";

// 获取频道列表
import { apiGetArticle } from "@/apis/publish";

function useChannels() {
  const [channels, setChannels] = useState([]);
  useEffect(() => {
    const getChannels = async function () {
      const res = await apiGetArticle();
      setChannels((pre) => {
        return [...pre, ...res.data.channels];
      });
    };
    getChannels();
  }, []);
  return channels;
}
export default useChannels;
